﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
//using LTP.Accounts.Bus;
namespace xxxy.Web.typeInfo
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
				{
					int tID=(Convert.ToInt32(Request.Params["id"]));
					ShowInfo(tID);
				}
			}
		}
			
	private void ShowInfo(int tID)
	{
		xxxy.BLL.typeInfo bll=new xxxy.BLL.typeInfo();
		xxxy.Model.typeInfo model=bll.GetModel(tID);
		this.lbltID.Text=model.tID.ToString();
		this.txttname.Text=model.tname;

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txttname.Text.Trim().Length==0)
			{
				strErr+="活动类型名称不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int tID=int.Parse(this.lbltID.Text);
			string tname=this.txttname.Text;


			xxxy.Model.typeInfo model=new xxxy.Model.typeInfo();
			model.tID=tID;
			model.tname=tname;

			xxxy.BLL.typeInfo bll=new xxxy.BLL.typeInfo();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
